<?php

declare(strict_types=1);

namespace App\CustHub\Mapper;

use App\CustHub\Model\ChOrder;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Model;
use Mine\Abstracts\AbstractMapper;
use Mine\MineModel;

class ChOrderMapper extends AbstractMapper
{
    public function assignModel()
    {
        $this->model = ChOrder::class;
    }

    /**
     * 通过订单号查询订单
     * @param string $orderNo
     * @return MineModel|Model|string|Builder|null
     */
    public function findByOrderNo(string $orderNo): ChOrder|Model|string|Builder|null
    {
        return $this->model::query()->where('order_no', $orderNo)->first();
    }
}